home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 2
/
The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO
/
clang
/
objeas1a.zip
/
OEDEMO.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1992-11-04
|
53KB
|
2,123 lines
#include <object.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <graphics.h>
//************************* FUNCTION PROTOTYPES **************************
void initialize();
void introscreen();
void explainscreen();
void windowdemo();
void menudemo();
void stringdemo();
void buttondemo();
void checkboxdemo();
void textmousedemo();
void wrapup();
void sumitup();
void initvidbiosdemo();
void initgraphicdemo();
//*************************** GLOBAL VARIABLES ***************************
extern Mcursor the_mouse;
Screen screen;
int mouse_present=0;
//**************************************************************************
// MAIN
//**************************************************************************
void main()
{
initialize();
introscreen();
explainscreen();
windowdemo();
menudemo();
stringdemo();
buttondemo();
checkboxdemo();
textmousedemo();
wrapup();
initvidbiosdemo();
initgraphicdemo();
closegraph();
puts("Thank you for previewing the ObjectEase library from");
puts("David S. Reinhart Associates");
exit(0);
}
//**************************************************************************
// INITIALIZE
//**************************************************************************
void initialize()
{
char ch;
clrscr();
flushkeys();
if(!the_mouse.init()) {
puts("Mouse driver not found. If you have a mouse, press <ESC> now");
puts("to exit and load your mouse driver. Press any other key to continue.");
ch=getch();
if(ch==27)
exit(1);
}
else
mouse_present=1;
the_mouse.unarm();
cursoroff();
}
//**************************************************************************
// INTROSCREEN
//**************************************************************************
void introscreen()
{
int done=0;
char ch;
clear(32,0,0);
printc(8,15,0,"This demonstration program is a compilation of demos");
printc(9,15,0,"for the various libraries which make up the ObjectEase library.");
printc(10,15,0,"All of the functions demonstrated herein plus many more are now");
printc(11,15,0,"available in the first COMPLETE C++ library - The ObjectEase");
printc(12,15,0,"library from David S. Reinhart Associates.");
printc(22,15+128,0,"Press any key to begin...");
getch();
flushkeys();
clear(32,1,1);
dlay(8);
smoved(37,1,7,14,1,"Welcome");
dlay(3);
smover(9,1,35,14,1,"To The World");
dlay(3);
smovel(11,79,40,14,1,"Of");
dlay(3);
smoveu(31,25,14,15,1,">>> ObjectEase <<<");
Twindow creditwindow;
creditwindow.init(5,18,76,24,0,3,0,0);
creditwindow.setborder(DOUBLE);
creditwindow.zoom();
creditwindow.title(" DEMO ");
creditwindow.border();
creditwindow.wprintc(2,15,3,"The ObjectEase Library Demo");
creditwindow.wprintc(3,15,3,"(c) Copyright 1992 - David S. Reinhart Asociates");
creditwindow.wprintc(5,14,3,"Press <ENTER> to continue...");
while(!done) {
smover(16,25,53,11,1,"***");
if(kbhit()) {
ch=getch();
if(ch==13) {
ungetch(ch);
done=1;
continue;
}
}
smoveu(53,16,5,11,1,"***");
if(kbhit()) {
ch=getch();
if(ch==13) {
ungetch(ch);
done=1;
continue;
}
}
smovel(5,53,25,11,1,"***");
if(kbhit()) {
ch=getch();
if(ch==13) {
ungetch(ch);
done=1;
continue;
}
}
smoved(25,5,16,11,1,"***");
if(kbhit()) {
ch=getch();
if(ch==13) {
ungetch(ch);
done=1;
continue;
}
if(ch==27) {
clrscr();
exit(0);
}
}
}
clear(32,1,1);
}
//*************************************************************************
// EXPLAINSCREEN
//*************************************************************************
void explainscreen()
{
char ch;
Twindow mainwindow;
mainwindow.init(1,1,80,25,15,1,0,0);
mainwindow.title(" ObjectEase ");
mainwindow.show();
mainwindow.divider(HOR,DOUBLE,2);
printc(2,14,1,"Text Mode Features");
dlay(18);
//WINDOW
Twindow demowindow;
demowindow.init(10,5,20,10,0,3,1,9);
demowindow.zoom();
printat(11,12,14,1,"Windows");
dlay(18*2);
//MENU
Tmenu demomenu;
itemarray items;
strcpy(items[1],"Item 1");
strcpy(items[2],"Item 2");
strcpy(items[3],"Item 3");
demomenu.init(3,items,35,5,15,15,4,14,0,1,9);
demomenu.setborder(DOUBLE);
demomenu.show();
printat(39,12,14,1,"Menus");
dlay(18*2);
//BUTTON
Tbutton button1;
button1.init(64,6," Start ",2);
Tbutton button2;
button2.init(64,8," Stop ",3);
button1.show(1);
button2.show(1);
printat(65,12,14,1,"Buttons");
dlay(18*2);
//STRING
Tstring the_string;
Tdate the_date;
the_string.init(20,18,15,0);
the_string.setincolors(14,0);
the_string.show();
the_date.init(20,20);
the_date.setincolors(14,0);
the_date.show();
printat(10,18,11,1,"Name: ");
printat(10,20,11,1,"Date: ");
printat(10,22,14,1,"String Input");
dlay(18*2);
//CHECKBOX
Tcheckbox yesbox;
yesbox.init(60,18,15,1);
Tcheckbox nobox;
nobox.init(60,20,15,1);
yesbox.show();
yesbox.check();
nobox.show();
printat(55,18,15,1,"Yes");
printat(55,20,15,1,"No ");
printat(55,22,14,1,"Check Boxes");
dlay(18*2);
printc(24,15+128,1,"Press <ENTER> to continue");
flushkeys();
getkey:
while(!kbhit());
ch=getch();
if(ch==27) {
clrscr();
exit(0);
}
if(ch!=13) {
flushkeys();
goto getkey;
}
}
//*************************************************************************
// WINDOWDEMO
//*************************************************************************
void windowdemo()
{
char ch;
clear(32,1,1);
dlay(12);
smover(12,1,37,14,1,"Windows");
dlay(18*2);
smover(12,37,74,14,1,"Windows");
clear(176,15,1);
dlay(18);
printat(20,10,15,1,"With this simple piece of code...");
printat(25,12,15,1,"Twindow the_window;");
printat(25,13,15,1,"the_window.init(10,5,71,20,14,4,1,7);");
dlay(18*3);
printat(20,15,15,1,"You have created this window...");
dlay(18*3);
Twindow demowindow;
demowindow.init(10,5,71,20,14,4,1,7);
demowindow.show();
dlay(18*3);
printat(20,8,15,4,"Want to change the border? Try this...");
printat(25,10,15,4,"the_window.setborder(DOUBLE);");
printat(25,11,15,4,"the_window.border();");
dlay(18*3);
demowindow.setborder(DOUBLE);
demowindow.border();
dlay(18*3);
printat(20,14,15,4,"Now to clear the window...");
printat(25,16,15,4,"the_window.fill();");
dlay(18*3);
demowindow.fill();
dlay(18*3);
printat(20,10,15,4,"Let's add a title. We'll call it Window 1.");
printat(25,12,15,4,"the_window.title(\"Window 1\");");
printat(25,13,15,4,"the_window.border();");
dlay(18*3);
demowindow.title("Window 1");
demowindow.border();
dlay(18*3);
demowindow.fill();
printat(20,10,15,4,"No, how about a heading instead of a title.");
printat(25,12,15,4,"the_window.divider(HOR,DOUBLE,2);");
printat(25,13,15,4,"the_window.wprintc(1,15,4,\"Window 1\");");
dlay(18*3);
demowindow.title("");
demowindow.border();
demowindow.divider(HOR,DOUBLE,2);
demowindow.wprintc(1,15,4,"Window 1");
dlay(18*3);
demowindow.hide();
clear(176,15,1);
dlay(18);
printc(10,15,1,"You can display a window like this...");
printc(12,15,1,"the_window.show();");
dlay(18*3);
demowindow.show();
dlay(18*2);
demowindow.hide();
clear(176,15,1);
dlay(18);
printc(10,15,1,"Or ZOOM it like this...");
printc(12,15,1,"the_window.zoom();");
dlay(18*3);
demowindow.zoom();
dlay(18*2);
printc(10,15,4,"Hide a window with this call...");
printc(12,15,4,"the_window.hide();");
dlay(18*3);
demowindow.hide();
clear(176,15,1);
dlay(18*3);
Twindow warray[8];
for(int i=0;i<8;i++) {
warray[i].init(18+(i*3),4+(i*2),20+(18+(i*3)),4+(4+(i*2)),i+1,i,1,7);
warray[i].setborder(DOUBLE);
warray[i].show();
}
Twindow newwindow;
newwindow.init(5,8,76,12,15,1,1,7);
newwindow.setborder(DOUBLE);
newwindow.zoom();
newwindow.wprintc(2,15,1,"Windows can overlap, and any underlying image is saved.");
dlay(18*4);
newwindow.hide();
dlay(18);
for(i=7;i>-1;i--) {
warray[i].hide();
dlay(18);
}
Twindow newerwindow;
newerwindow.init(4,3,77,18,0,3,1,7);
newerwindow.setborder(DOUBLE);
newerwindow.zoom();
newerwindow.divider(HOR,DOUBLE,2);
newerwindow.wprintc(1,14,3,"*** Features ***");
printc(7,0,3,"What you have just seen is just a small sampling of the power");
printc(8,0,3,"that you control using the Twindow class of the ObjectEase");
printc(9,0,3,"library. Here is a listing of some additional features:");
printc(11,15,3,"Change foreground and background colors");
printc(12,15,3,"Print to a specific window");
printc(13,15,3,"Specify shadow or no shadow");
printc(14,15,3,"Have the window tell you all of it's details");
printc(15,15,3,"Never fear corrupted or lost memory, as a Twindow");
printc(16,15,3,"frees all of its accociated memory when it leaves scope");
dlay(18*4);
printc(25,15+128,1,"Press <ENTER> to continue...");
getkey:
while(!kbhit());
ch=getch();
if(ch==27) {
clrscr();
exit(0);
}
if(ch!=13) {
flushkeys();
goto getkey;
}
}
//**************************************************************************
// MENUDEMO
//**************************************************************************
void menudemo()
{
char ch;
clear(32,1,1);
dlay(12);
smover(12,1,38,14,1,"Menus");
dlay(18*2);
smover(12,38,76,14,1,"Menus");
clear(176,15,1);
dlay(18);
clear(176,15,1);
Twindow textwindow;
textwindow.init(5,3,76,15,15,3,1,7);
textwindow.setborder(DOUBLE);
textwindow.zoom();
textwindow.divider(HOR,DOUBLE,2);
textwindow.wprintc(1,14,3,"Menus");
printc(7,15,3,"The Tmenu class is descended from the Twindow class,");
printc(8,15,3,"therefore inheriting all of the member functions of the");
printc(9,15,3,"Twindow class. To use a Tmenu instance in its simplest form");
printc(10,15,3,"simply pass it the structure containing your menu selections");
printc(11,15,3,"and capture the returned value. We won't go into details");
printc(12,15,3,"as with the Twindow class, but rest assured the Tmenu class");
printc(13,15,3,"is just as powerful and as easy to implement!");
dlay(18*5);
printc(25,15+128,1,"Press <ENTER> to continue...");
getkey:
while(!kbhit());
ch=getch();
if(ch==27) {
clrscr();
exit(0);
}
if(ch!=13) {
flushkeys();
goto getkey;
}
clear(176,15,1);
Tmenu demomenu;
itemarray items;
strcpy(items[1],"Item number 1");
strcpy(items[2],"Item number 2");
strcpy(items[3],"Item number 3");
strcpy(items[4],"Continue");
demomenu.init(4,items,10,13,20,15,1,14,5,1,8);
demomenu.title("Sample");
Twindow the_window;
the_window.init(15,4,66,8,15,1,1,7);
the_window.zoom();
printc(6,14,1,"Go ahead, experiment with this sample menu.");
int done=0;
while(!done) {
int choice=demomenu.show();
switch(choice) {
case 1: demomenu.cfgd(7);
printat(50,13,15,1,"You chose 1");
printf("\a");
dlay(18);
demomenu.cfgd(15);
continue;
case 2: demomenu.cfgd(7);
printat(50,13,15,1,"You chose 2");
printf("\a");
dlay(18);
demomenu.cfgd(15);
continue;
case 3: demomenu.cfgd(7);
printat(50,13,15,1,"You chose 3");
printf("\a");
dlay(18);
demomenu.cfgd(15);
continue;
case 4: demomenu.cfgd(7);
done=1;
dlay(9);
continue;
}//switch
}//done
demomenu.hide();
clear(176,15,1);
}
//**************************************************************************
// STRINGDEMO
//**************************************************************************
void stringdemo()
{
char ch;
clear(32,1,1);
dlay(12);
smover(12,1,37,14,1,"Strings");
dlay(18*2);
smover(12,37,74,14,1,"Strings");
clear(176,15,1);
Twindow the_window;
the_window.init(5,3,76,16,0,3,1,7);
the_window.setborder(DOUBLE);
the_window.zoom();
the_window.divider(HOR,DOUBLE,2);
printc(4,14,3,"String Input");
printc(7,15,3,"The Tstring class is going to be your best friend. There is");
printc(8,15,3,"NO easier way to get user input in such a variety of formats.");
printc(9,15,3,"The Tstring class has two descendants, Tnumeral and Tdate");
printc(10,15,3,"which allow you to capture and convert any data type.");
printc(11,15,3,"Have you ever tried to design a form that would let the user");
printc(12,15,3,"move to any desired input field, up or down, back and forth?");
printc(13,15,3,"If you have, I'm sure you've met with the same frustration as");
printc(14,15,3,"most other programmers. Your headaches are now over...");
dlay(18*5);
printc(25,15+128,1,"Press <ENTER> to continue");
getkey:
while(!kbhit());
ch=getch();
if(ch==27) {
clrscr();
exit(0);
}
if(ch!=13) {
flushkeys();
goto getkey;
}
the_window.hide();
clear(176,15,1);
Twindow formwindow;
formwindow.init(10,5,71,17,14,2,1,7);
formwindow.title("Input");
formwindow.show();
Tstring lname;
Tstring fname;
Tstring address;
Tstring csz;
Tnumeral age;
lname.init(40,7,15,0);
lname.setincolors(15,0);
fname.init(40,9,10,0);
fname.setincolors(15,0);
address.init(40,11,20,0);
address.setincolors(15,0);
csz.init(40,13,25,0);
csz.setincolors(15,0);
age.init(40,15,2,0);
age.setincolors(15,0);
printc(2,14,1,"Try this one on for size...");
printc(3,14,1,"Notice that all of the standard editing keys are available.");
printat(15,7,14,2,"Last name: ");
lname.show();
printat(15,9,14,2,"First name: ");
fname.show();
printat(15,11,14,2,"Address: ");
address.show();
printat(15,13,14,2,"City, State, Zip: ");
csz.show();
printat(15,15,14,2,"Age: ");
age.show();
cursoron();
getlname:
lname.get_form_input();
if(lname.uparrowhit())
goto getage;
if(lname.dnarrowhit())
goto getfname;
getfname:
fname.get_form_input();
if(fname.dnarrowhit())
goto getaddress;
if(fname.uparrowhit())
goto getlname;
getaddress:
address.get_form_input();
if(address.uparrowhit())
goto getfname;
if(address.dnarrowhit())
goto getcsz;
getcsz:
csz.get_form_input();
if(csz.uparrowhit())
goto getaddress;
if(csz.dnarrowhit())
goto getage;
getage:
age.get_form_input();
if(age.uparrowhit())
goto getcsz;
if(age.dnarrowhit())
goto getlname;
cursoroff();
vprintat(35,20,15,1,"%s %s",fname.getstring(),lname.getstring());
vprintat(35,21,15,1,"%s",address.getstring());
vprintat(35,22,15,1,"%s",csz.getstring());
vprintat(35,23,15,1,"%d",age.getint());
dlay(18*2);
formwindow.hide();
clear(176,15,1);
the_window.zoom();
printc(5,14,3,"Additional features");
printc(7,15,3,"Force strings to all capitals");
printc(8,15,3,"Detect <ENTER>, <ESC>, <TAB>, <UP ARROW>, <DN ARROW>");
printc(9,15,3,"<HOME>, <END>, <BACKSPACE>, <DEL>, as well as mouse keypresses");
printc(10,15,3,"Return numerals as ints, floats, or longs");
printc(11,15,3,"Change the colors of the input fields");
printc(12,15,3,"Format and verify date fields");
dlay(18*5);
flushkeys();
printc(25,15+128,1,"Press <ENTER> to continue...");
getch();
}
//**************************************************************************
// BUTTONDEMO
//**************************************************************************
void buttondemo()
{
int done=0;
char ch;
clear(32,1,1);
dlay(12);
smover(12,1,37,14,1,"Buttons");
dlay(18*2);
smover(12,37,74,14,1,"Buttons");
clear(176,15,1);
dlay(9);
Twindow demowindow;
demowindow.init(5,3,76,18,15,3,1,7);
demowindow.setborder(DOUBLE);
demowindow.zoom();
demowindow.divider(HOR,DOUBLE,2);
printc(4,14,3,"Buttons");
printc(7,15,3,"Pushbuttons provide yet another easy way to get input from");
printc(8,15,3,"the users of your applications. There are times when a menu");
printc(9,15,3,"is just too much, and that's when a pushbutton can serve the");
printc(10,15,3,"purpose perfectly. Pushbuttons can be activated by any trigger");
printc(11,15,3,"you choose, but the most common trigger is the ALT key combined");
printc(12,15,3,"with the highlighted letter, or of course the mouse.");
printc(13,15,3,"Give these buttons a try to get a feel for their use...");
Tbutton button1;
button1.init(20,15,"Button 1",1);
Tbutton button2;
button2.init(35,15,"Button 2",2);
Tbutton button3;
button3.init(50,15,"Continue",1);
button1.show(3);
button2.show(3);
button3.show(3);
while(!done) {
if(kbhit()) {
ch=getch();
if(altkey()) {
ch=getch();
switch(ch) {
case ALTB: button1.press(3);
while(altkey());
button1.show(3);
continue;
case ALTU: button2.press(3);
while(altkey());
button2.show(3);
continue;
case ALTC: button3.press(3);
while(altkey());
button3.show(3);
done=1;
continue;
}
}//if altkey
else
flushkeys();
}//if kbhit
}//while
clear(176,15,1);
}
//*************************************************************************
// CHECKBOXDEMO
//*************************************************************************
void checkboxdemo()
{
char ch;
int done=0;
clear(32,1,1);
dlay(12);
smover(12,1,35,14,1,"Checkboxes");
dlay(18*2);
smover(12,35,71,14,1,"Checkboxes");
clear(176,15,1);
dlay(9);
Twindow the_window;
the_window.init(5,3,76,19,15,3,1,7);
the_window.setborder(DOUBLE);
the_window.zoom();
the_window.divider(HOR,DOUBLE,2);
printc(4,14,3,"Checkboxes");
printc(7,15,3,"One final way to capture user input is through the use of");
printc(8,15,3,"checkboxes. Checkboxes can provide the user with a means of");
printc(9,15,3,"making multiple selections. All your program needs to do");
printc(10,15,3,"\"ask\" the checkbox if it has been checked or not. The");
printc(11,15,3,"POWER of the object! The spacebar or the mouse is generally");
printc(12,15,3,"the trigger to toggle a checkbox's state, however, you may");
printc(13,15,3,"employ any trigger you choose. Try these samples using the");
printc(14,15,3,"<TAB> key to move among the checkboxes. Check the CONTINUE");
printc(15,15,3,"box and press <ENTER> when done.");
Tcheckbox check1;
check1.init(25,17,14,3);
Tcheckbox check2;
check2.init(40,17,14,3);
Tcheckbox check3;
check3.init(55,17,14,3);
printat(15,17,15,3,"Check #1:");
check1.show();
printat(30,17,15,3,"Check #2:");
check2.show();
printat(45,17,15,3,"Continue:");
check3.show();
cursoron();
check1.grabcursor();
int active1=1,active2=0,active3=0;
while(!done) {
if(kbhit()) {
ch=getch();
if(ch!=32 && ch!=9 && ch!=13) {
flushkeys();
continue;
}
if(ch==32) {
if(active1) {
if(check1.ischecked())
check1.uncheck();
else
check1.check();
}
if(active2) {
if(check2.ischecked())
check2.uncheck();
else
check2.check();
}
if(active3) {
if(check3.ischecked())
check3.uncheck();
else
check3.check();
}
}//ch==32
if(ch==9) {
if(active1) {
check2.grabcursor();
active1=0;
active2=1;
continue;
}
if(active2) {
check3.grabcursor();
active2=0;
active3=1;
continue;
}
if(active3) {
check1.grabcursor();
active3=0;
active1=1;
continue;
}
}//ch==9;
if(ch==13) {
if(check3.ischecked()) {
done=1;
continue;
}
}
}//kbhit
}//!done
cursoroff();
clear(176,15,1);
dlay(18*1);
}
//**************************************************************************
// TEXTMOUSEDEMO
//**************************************************************************
void textmousedemo()
{
int done=0;
char ch;
Twindow top;
top.init(1,1,80,4,15,1,0,0);
top.zoom();
printc(2,14,1,"OK, now let's put it all to use. If you have a mouse,");
printc(3,14,1,"use it also to select any field or option you choose.");
Twindow form;
form.init(5,6,76,15,15,3,1,7);
form.setborder(DOUBLE);
form.show();
Tstring lname;
Tstring fname;
Tbutton donebutton;
donebutton.init(55,11," Complete ",2);
Tcheckbox yesbox;
yesbox.init(45,11,15,3);
Tcheckbox nobox;
nobox.init(45,13,15,3);
printat(10,7,14,3,"First name: ");
printat(10,9,14,3,"Last name: ");
fname.init(25,7,10,0);
fname.setincolors(14,0);
fname.show();
lname.init(25,9,15,0);
lname.setincolors(14,0);
lname.show();
printat(10,12,14,3,"Enjoying demo thus far?");
printat(40,11,14,3,"Yes");
printat(40,13,14,3,"No ");
yesbox.show();
nobox.show();
yesbox.check();
donebutton.show(3);
the_mouse.arm();
cursoron();
while(!done) {
getfname:
fname.get_form_mouse_input();
if(the_mouse.LBP())
goto checkmouse;
if(fname.dnarrowhit() || fname.tabhit())
goto getlname;
if(fname.uparrowhit())
goto getdone;
getlname:
lname.get_form_mouse_input();
if(the_mouse.LBP())
goto checkmouse;
if(lname.uparrowhit())
goto getfname;
if(lname.dnarrowhit() || lname.tabhit())
goto getyes;
getyes:
yesbox.grabcursor();
while(!kbhit() && !the_mouse.LBP());
if(the_mouse.LBP())
goto checkmouse;
ch=getch();
if(ch==32) {
if(yesbox.ischecked()) {
yesbox.uncheck();
nobox.check();
}
else {
yesbox.check();
nobox.uncheck();
}
}
if(ch==9) {
flushkeys();
goto getno;
}
if(ch==0) {
ch=getch();
if(ch==80)
goto getno;
if(ch==72)
goto getlname;
flushkeys();
}
else {
flushkeys();
goto getyes;
}
getno:
nobox.grabcursor();
while(!kbhit() && !the_mouse.LBP());
if(the_mouse.LBP())
goto checkmouse;
ch=getch();
if(ch==32) {
if(nobox.ischecked()) {
nobox.uncheck();
yesbox.check();
}
else {
nobox.check();
yesbox.uncheck();
}
}
if(ch==9) {
flushkeys();
goto getdone;
}
if(ch==0) {
ch=getch();
if(ch==80)
goto getdone;
if(ch==72)
goto getyes;
flushkeys();
}
else {
flushkeys();
goto getno;
}
getdone:
gotoxy(57,11);
while(!kbhit() && ! the_mouse.LBP());
if(the_mouse.LBP())
goto checkmouse;
ch=getch();
if(altkey()) {
ch=getch();
if(ch==ALTC) {
donebutton.press(3);
while(altkey());
donebutton.show(3);
done=1;
continue;
}
}
if(ch==13) {
donebutton.press(3);
dlay(3);
donebutton.show(3);
done=1;
continue;
}
if(ch==9)
goto getfname;
if(ch==0) {
ch=getch();
if(ch==72)
goto getno;
if(ch==80)
goto getfname;
flushkeys();
}
checkmouse:
if(the_mouse.LBP()) {
if(fname.hit()) {
while(the_mouse.LBP());
goto getfname;
}
if(lname.hit()) {
while(the_mouse.LBP());
goto getlname;
}
if(yesbox.hit()) {
if(yesbox.ischecked()) {
yesbox.uncheck();
nobox.check();
while(the_mouse.LBP());
}
else {
yesbox.check();
nobox.uncheck();
while(the_mouse.LBP());
}
goto getyes;
}
if(nobox.hit()) {
if(nobox.ischecked()) {
nobox.uncheck();
yesbox.check();
while(the_mouse.LBP());
}
else {
nobox.check();
yesbox.uncheck();
while(the_mouse.LBP());
}
goto getno;
}
if(donebutton.buttonpressed()) {
donebutton.press(3);
while(the_mouse.LBP());
donebutton.show(3);
done=1;
continue;
}
}
}//while !done
cursoroff();
}
//**************************************************************************
// WRAPUP
//**************************************************************************
void wrapup()
{
clear(32,1,1);
dlay(12);
smoved(36,1,12,14,1,"Summary");
dlay(18*2);
smoveu(36,12,1,14,1,"Summary");
clear(176,15,1);
dlay(9);
Twindow summwindow;
summwindow.init(4,3,77,19,14,2,1,7);
summwindow.show();
summwindow.divider(HOR,DOUBLE,2);
summwindow.wprintc(1,15,2,"Text Mode Features");
printc(7,14,2,"You have now seen the richness of the features available");
printc(8,14,2,"in the text mode objects of the ObjectEase class library.");
printc(9,14,2,"Understand that this demo does not allow for all of the member");
printc(10,14,2,"functions to be demonstrated. You, the programmer, have total");
printc(11,14,2,"control over every aspect of these objects. End the cycle of");
printc(12,14,2,"re-inventing the wheel... use these objects to piece together");
printc(13,14,2,"application after application maintaining consistency and ease");
printc(14,14,2,"of use. Object oriented technology makes application development");
printc(15,14,2,"so much easier for the programmer. You need to take advantage");
printc(16,14,2,"of this power NOW, or be left behind in the 1990's!");
dlay(18*8);
printc(25,15+128,1,"Press <ENTER> to continue...");
getch();
}
#define BKG 3
//***************************DEMO FUNCTIONS*********************************
void gbuttondemo();
void graphbuttondemo();
void paneldemo();
void icondemo();
void acticondemo();
void gmenudemo();
void inputdemo();
void finale();
void mcursordemo();
//************************SUPPORTING FUNCTIONS******************************
void write3d(int,char *);
void early_exit();
void norm_exit();
void do_siren();
void do_tele();
//**************************GLOBAL VARIABLES********************************
char ch; //generic character variable
//**************************************************************************
//**************************************************************************
//**************************************************************************
void initgraphicdemo()
{
int gd=VGA,gm=VGAHI;
int errorcode;
if(!the_mouse.init()) {
puts("Unable to detect mouse driver. Graphic portion of this demo");
puts("requires a mouse.");
exit(1);
}
registerbgidriver(EGAVGA_driver);
initgraph(&gd,&gm,"");
errorcode=graphresult();
if(errorcode!=grOk) {
puts("Could not establish 640 x 480 16 color graphics mode");
exit(1);
}
delay(1000);
setfillstyle(SOLID_FILL,BKG);
bar(0,0,getmaxx(),getmaxy());
Bevel mainpanel;
mainpanel.init(50,75,540,125,THICK);
mainpanel.show();
settextjustify(CENTER_TEXT,TOP_TEXT);
write3d(100,"ObjectEase graphics demonstration for Borland C++ and");
write3d(115,"Turbo C++. This demo and the included graphics library file(s)");
write3d(130,"(c) Copyright 1992, David S. Reinhart Associates");
write3d(160,"Press the <ENTER> key or the right mouse key to progress through");
write3d(175,"the demo.");
Panel copyrightpanel;
copyrightpanel.init(3,455,634,21,OUT,THIN);
copyrightpanel.show();
setcolor(0);
write3d(465,"(c) Copyright 1992 - David S. Reinhart Associates");
the_mouse.show();
int selected=0;
while(!selected) {
while(!kbhit() && !the_mouse.RBP());
if(kbhit()) {
if((ch=getch())==27)
early_exit();
while(kbhit())getch();
selected=1;
}
if(the_mouse.RBP())
selected=1;
}
gbuttondemo();
graphbuttondemo();
icondemo();
acticondemo();
paneldemo();
gmenudemo();
inputdemo();
mcursordemo();
finale();
// norm_exit();
}
void mcursordemo()
{
int cur=1;
the_mouse.hide();
setfillstyle(SOLID_FILL,3);
bar(0,0,getmaxx(),getmaxy()-30);
write3d(20,"Press the left mouse key to cycle through cursors.");
write3d(35,"Press right mouse key to end.");
the_mouse.show();
while(!the_mouse.RBP()) {
if(the_mouse.LBP()) {
cur++;
if(cur>16)cur=1;
the_mouse.changeto(cur);
while(the_mouse.LBP());
}
}
}
//**************************************************************************
void gbuttondemo()
{
setfillstyle(SOLID_FILL,BKG);
the_mouse.hide();
bar(0,0,getmaxx(),getmaxy()-40);
Bevel mainpanel;
mainpanel.init(30,70,580,230,THICK);
mainpanel.show();
write3d(85,"Buttons are one of the most fundamental graphic objects.");
write3d(100,"They are very popular within graphics environments");
write3d(115,"for getting user input. You, the programmer, have complete");
write3d(130,"control over how these button objects function. That is");
write3d(145,"to say, whether the resulting action takes place when the");
write3d(160,"button is pressed or released; how long the button remains");
write3d(175,"depressed; etc... Experiment with the buttons below.");
Button lowbutton;
Button medbutton;
Button hibutton;
Panel buttonpanel;
lowbutton.init(150,230," LOW ",TEXT);
medbutton.init(300,230," MED ",TEXT);
hibutton.init(450,230," HI ",TEXT);
buttonpanel.init(130,220,390,45,IN,THICK);
buttonpanel.show();
lowbutton.show();
medbutton.show();
hibutton.show();
the_mouse.show();
int selected=0;
flushkeys();
while(!selected) {
if(the_mouse.LBP()) {
if(lowbutton.hit()) {
lowbutton.press();
while(the_mouse.LBP() && lowbutton.hit());
lowbutton.show();
if(lowbutton.hit()) {
sound(220);
delay(500);
nosound();
continue;
}
}
if(medbutton.hit()) {
medbutton.press();
while(the_mouse.LBP() && medbutton.hit());
medbutton.show();
if(medbutton.hit()) {
sound(440);
delay(500);
nosound();
continue;
}
}
if(hibutton.hit()) {
hibutton.press();
while(the_mouse.LBP() && hibutton.hit());
hibutton.show();
if(hibutton.hit()) {
sound(880);
delay(500);
nosound();
continue;
}
}
}// end if the_mouse.LBP
if(the_mouse.RBP()) {
selected=1;
}
if(kbhit()) {
if((ch=getch())==27)
early_exit();
while(kbhit())getch();
selected=1;
}
}// end while !selected
}
//**************************************************************************
void graphbuttondemo()
{
the_mouse.hide();
setfillstyle(SOLID_FILL,BKG);
bar(0,0,getmaxx(),getmaxy()-40);
Bevel mainpanel;
mainpanel.init(50,50,getmaxx()-100,250,THICK);
mainpanel.show();
write3d(75,"Buttons can have not only text labels, but graphics as well!");
write3d(90,"Graphics not only make the interface look nicer, but can");
write3d(105,"also make the button's function more intuitive for the end user.");
write3d(120,"Try to guess what the outcome will be before trying out each of");
write3d(135,"the buttons below.");
write3d(165,"By the way, these graphic buttons are easy to create using the");
write3d(180,"ICONEDIT program supplied in this package.");
Panel buttonpanel;
Button sirenbutton;
Button telebutton;
buttonpanel.init(270,220,100,50,IN,THICK);
buttonpanel.show();
sirenbutton.init(285,235,"siren",1);
telebutton.init(330,235,"telefone",1);
sirenbutton.show();
telebutton.show();
the_mouse.show();
flushkeys();
int selected=0;
while(!selected) {
if(the_mouse.RBP())
selected=1;
if(kbhit()) {
if((ch=getch())==27)
early_exit();
while(kbhit())getch();
selected=1;
}
if(the_mouse.LBP()) {
if(sirenbutton.hit()) {
sirenbutton.press();
while(the_mouse.LBP() && sirenbutton.hit());
sirenbutton.show();
if(sirenbutton.hit()) {
do_siren();
continue;
}
}
if(telebutton.hit()) {
telebutton.press();
while(the_mouse.LBP() && telebutton.hit());
telebutton.show();
if(telebutton.hit()) {
do_tele();
continue;
}
}
}
}
}
//**************************************************************************
void paneldemo()
{
the_mouse.hide();
setfillstyle(SOLID_FILL,BKG);
bar(0,0,getmaxx(),getmaxy()-40);
Bevel mainpanel;
mainpanel.init(10,10,getmaxx()-20,70,THICK);
mainpanel.show();
write3d(25,"Panels offer an attractive way to partition the graphics screen.");
write3d(40,"Here are some of the different types of panels that can easily");
write3d(55,"be implemented using the ObjectEase library.");
Panel inthick;
Panel inthin;
Panel outthick;
Panel outthin;
Bevel thin;
Bevel thick;
delay(2000);
write3d(90,"THICK STYLES THIN STYLES");
inthick.init(50,105,200,100,IN,THICK);
inthick.show();
inthin.init(390,105,200,100,IN,THIN);
inthin.show();
delay(1000);
outthick.init(50,220,200,100,OUT,THICK);
outthick.show();
outthin.init(390,220,200,100,OUT,THIN);
outthin.show();
delay(1000);
thick.init(50,335,200,100,THICK);
thick.show();
thin.init(390,335,200,100,THIN);
thin.show();
the_mouse.show();
flushkeys();
while(!kbhit() && !the_mouse.RBP());
if(kbhit()) {
if((ch=getch())==27)
early_exit();
while(kbhit())getch();
}
}
//**************************************************************************
void icondemo()
{
the_mouse.hide();
setfillstyle(SOLID_FILL,BKG);
bar(0,0,getmaxx(),getmaxy()-40);
Bevel mainpanel;
mainpanel.init(50,50,getmaxx()-100,200,THICK);
mainpanel.show();
write3d(75,"What paint program would be complete without icons? Icons are");
write3d(90,"as intuitive to use as buttons, and once again, using the");
write3d(105,"ICONEDIT program, they are easy for you, the programmer, to");
write3d(120,"create. Check out the action of the icons below...");
Panel iconpanel;
Icon drawicon;
Icon painticon;
iconpanel.init(250,160,getmaxx()-500,50,IN,THICK);
iconpanel.show();
drawicon.init(280,170,"draw");
painticon.init(330,170,"painter");
drawicon.show();
painticon.show();
the_mouse.show();
flushkeys();
int selected=0;
while(!selected) {
if(the_mouse.RBP())
selected=1;
if(kbhit()) {
if((ch=getch())==27)
early_exit();
while(kbhit())getch();
selected=1;
}
if(the_mouse.LBP()) {
if(painticon.hit()) {
if(!painticon.ispressed()) {
painticon.choose();
drawicon.show();
while(the_mouse.LBP());
continue;
}
}
if(drawicon.hit()) {
if(!drawicon.ispressed()) {
drawicon.choose();
painticon.show();
while(the_mouse.LBP());
continue;
}
}
}
}
}
//**************************************************************************
void acticondemo()
{
the_mouse.hide();
setfillstyle(SOLID_FILL,BKG);
bar(0,0,getmaxx(),getmaxy()-40);
Bevel mainpanel;
mainpanel.init(50,50,getmaxx()-100,300,THICK);
mainpanel.show();
write3d(75,"Here's a neat graphic feature that you don't see everyday.");
write3d(90,"Want to really jazz up your interface? Want to make it stand");
write3d(105,"out in a crowd?! Instead of reversing the image of your icons");
write3d(120,"when they are selected, make them come to life! Click the icon");
write3d(135,"below to see what I mean.");
write3d(165,"And guess what... Right! These icons are also easy to create");
write3d(180,"using the ICONEDIT program");
Panel iconpanel;
iconpanel.init(270,230,getmaxx()-(270*2),70,IN,THICK);
iconpanel.show();
Acticon aicon;
aicon.init(305,250,"icon");
aicon.show(1);
the_mouse.show();
int selected=0;
while(!selected) {
if(the_mouse.RBP())
selected=1;
if(kbhit()) {
if((ch=getch())==27)
early_exit();
while(kbhit())getch();
selected=1;
}
if(the_mouse.LBP()) {
if(aicon.hit()) {
while(!the_mouse.RBP() && !kbhit())
aicon.backforth(2);
if(kbhit()) {
flushkeys();
selected=1;
}
if(the_mouse.RBP())
selected=1;
}
}
}
}
//**************************************************************************
void gmenudemo()
{
the_mouse.hide();
setfillstyle(SOLID_FILL,BKG);
bar(0,0,getmaxx(),getmaxy()-40);
Bevel mainpanel;
mainpanel.init(30,50,getmaxx()-60,130,THICK);
mainpanel.show();
write3d(75,"Do you need to include point and shoot type menu bars in your");
write3d(90,"applications? No problem! Using the ObjectEase library makes it a snap");
write3d(105,"for you to include graphic pulldown menus! See for yourself below.");
write3d(120,"You may want to note that the way these menus are implemented");
write3d(135,"requires you to keep the left mouse key pressed until you have made");
write3d(150,"your selection.");
setfillstyle(SOLID_FILL,15);
bar(0,200,getmaxx(),210);
setfillstyle(SOLID_FILL,1);
bar(0,211,getmaxx(),350);
Gmenubutton menubutton1;
Gmenubutton menubutton2;
gitemarray itemarray1;
gitemarray itemarray2;
Gmenu gmenu1;
Gmenu gmenu2;
strcpy(itemarray1[1],"Item 1");
strcpy(itemarray1[2],"Item 2");
strcpy(itemarray1[3],"Item 3");
strcpy(itemarray1[4],"Item 4");
strcpy(itemarray2[1],"Item 1");
strcpy(itemarray2[2],"Item 2");
strcpy(itemarray2[3],"Item 3");
strcpy(itemarray2[4],"Item 4");
gmenu1.init(0,211,4,itemarray1);
gmenu2.init(100,211,4,itemarray2);
menubutton1.init(0,200,0,15,15,0,"Menu 1");
menubutton2.init(100,200,0,15,15,0,"Menu 2");
menubutton1.show();
menubutton2.show();
the_mouse.show();
int selected=0;
while(!selected) {
if(kbhit()) {
if((ch=getch())==27)
early_exit();
flushkeys();
selected=1;
}
if(the_mouse.RBP())
selected=1;
if(the_mouse.LBP()) {
if(menubutton1.hit()) {
menubutton1.press();
gmenu1.show();
gmenu1.hide();
menubutton1.show();
}
if(menubutton2.hit()) {
menubutton2.press();
gmenu2.show();
gmenu2.hide();
menubutton2.show();
}
}
}
}
//**************************************************************************
void inputdemo()
{
the_mouse.hide();
setfillstyle(SOLID_FILL,BKG);
bar(0,0,getmaxx(),getmaxy()-40);
Bevel mainpanel;
mainpanel.init(30,50,getmaxx()-60,150,THICK);
mainpanel.show();
write3d(75,"Getting text input from a graphic based application used to be");
write3d(90,"a real hassle... NO MORE! The ObjectEase includes functions for");
write3d(105,"laying out text input fields, simulating the text cursor, and");
write3d(120,"handling the text strings input by the user. Now you can");
write3d(135,"capture graphic text input as easily as in text mode.");
write3d(150,"Try out the sample dialog below.");
Panel dialogpanel;
dialogpanel.init(150,250,getmaxx()-300,85,IN,THICK);
dialogpanel.show();
setcolor(15);
settextjustify(LEFT_TEXT,TOP_TEXT);
gprintxy(170,275,"First Name: ");
gprintxy(170,305,"Last Name: ");
Gstring fname;
Gstring lname;
fname.init(270,279,20,0);
lname.init(270,309,20,0);
fname.show();
lname.show();
fname.get_input();
lname.get_input();
write3d(400,"Press <ENTER> to continue...");
flushkeys();
while(!the_mouse.RBP() && !kbhit());
if(kbhit()) {
if((ch=getch())==27)
early_exit();
flushkeys();
}
}
//**************************************************************************
void finale()
{
sumitup();
setgraphmode(VGAHI);
dlay(18);
the_mouse.hide();
setfillstyle(SOLID_FILL,BKG);
bar(0,0,getmaxx(),getmaxy()-40);
Bevel mainpanel;
mainpanel.init(20,50,getmaxx()-40,330,THICK);
mainpanel.show();
write3d(75,"Thank you for previewing the ObjectEase library from");
write3d(90,"David S. Reinhart Associates.");
write3d(110,"If you're serious about developing efficient, well");
write3d(125,"structured C++ programs, then the ObjectEase library");
write3d(140,"is a must for you! Why spend YOUR valuable time recreating");
write3d(155,"these powerful tools? Why spend hundreds of dollars to");
write3d(170,"acquire the multiple libraries it would take to duplicate");
write3d(185,"the features of ObjectEase? Order today! Your satisfaction");
write3d(200,"is GUARANTEED!");
write3d(220,"Single copy license - $79.95 each");
write3d(235,"Four or more copies - $59.95 each");
write3d(270,"David S. Reinhart Associates");
write3d(295,"1004 Marticville Rd.");
write3d(310,"Pequea, PA 17565");
write3d(325,"(717) 284-3736");
while(!kbhit() && !the_mouse.RBP());
flushkeys();
}
//**************************************************************************
void write3d(int y,char *text)
{
settextjustify(CENTER_TEXT,TOP_TEXT);
setcolor(0);
outtextxy(getmaxx()/2,y,text);
setcolor(15);
outtextxy((getmaxx()/2)-1,y-1,text);
}
//**************************************************************************
void do_siren()
{
int i;
for(i=500;i<1000;i+=7) {
sound(i);
delay(12);
}
for(i=1000;i>500;i-=7) {
sound(i);
delay(12);
}
nosound();
}
//**************************************************************************
void do_tele()
{
int i;
for(i=0;i<14;i++) {
sound(440);
delay(30);
sound(880);
delay(30);
}
nosound();
}
//**************************************************************************
void early_exit()
{
closegraph();
puts("You have not seen the entire demonstration.");
exit(0);
}
//**************************************************************************\
void norm_exit()
{
closegraph();
printat(1,1,14,0,"Thank you for previewing the ObjectEase library from David S. Reinhart Associates.");
printat(1,3,14,0,"Please read the enclosed documentation for complete instructions");
printat(1,4,14,0,"on using these objects and functions in your programs. Please note");
printat(1,5,14,0,"that this package is complete and not crippled or restricted");
printat(1,6,14,0,"in any way. If you decide to use this library in your own programs");
printat(1,7,14,0,"you must register your copy with the author. Failure to do so will");
printat(1,8,14,0,"bring about severe penalties. Use the registration form supplied");
printat(1,9,14,0,"in the file \"REGISTER.DOC\" to register your copy.");
printat(1,11,14,0,"Again, thank you and happy programming.");
gotoxy(1,13);
}
//**************************************************************************
void intro();
void demo1();
void demo2();
void demo3();
void demo4();
void demo5();
void demo6();
void outro();
unsigned char def_pal[17];
void initvidbiosdemo()
{
char ch;
the_mouse.init();
the_mouse.unarm();
randomize();
cursoroff();
clrscr();
Twindow mainwindow;
mainwindow.init(1,1,80,25,15,0,0,0);
mainwindow.title("VIDBIOS DEMO");
mainwindow.setborder(DOUBLE);
mainwindow.show();
intro();
demo1();
mainwindow.fill();
demo2();
mainwindow.fill();
demo3();
mainwindow.fill();
demo4();
mainwindow.fill();
demo5();
mainwindow.fill();
demo6();
clear(32,0,0);
dlay(18);
// mainwindow.fill();
// outro();
// mainwindow.hide();
cursoron();
}
//*************************************************************************
void intro()
{
Twindow introwindow;
introwindow.init(4,6,77,18,14,2,0,0);
introwindow.title("Introduction");
introwindow.show();
printc(8,14,2,"This short demo program highlights the video bios features of the");
printc(9,14,2,"ObjectEase library. Note that these library functions will work ONLY on");
printc(10,14,2,"VGA cards. If the program you are developing is intended for use on");
printc(11,14,2,"a variety of video equipment, be sure to test for the existence of");
printc(12,14,2,"a VGA card before calling these functions. If using an accelerated");
printc(13,14,2,"video card the fade routines will happen too quickly to be" );
printc(14,14,2,"appreciated. They will work fine on any standard VGA card.");
printc(16,15,2,"Press any key now to get on with the show...");
getch();
introwindow.hide();
flushkeys();
}
//*************************************************************************
void demo1()
{
Twindow demo1window;
demo1window.init(40,8,76,13,15,1,0,0);
demo1window.show();
printat(42,10,15,1," Fade any indivual palette color");
printat(42,11,15,1," in and out as desired. ");
printat(5,5,1,0,"Blue ████████");
printat(5,6,2,0,"Green ████████");
printat(5,7,3,0,"Cyan ████████");
printat(5,8,4,0,"Red ████████");
printat(5,9,5,0,"Magenta ████████");
printat(5,10,6,0,"Brown ████████");
printat(5,11,7,0,"Lt. Gray ████████");
printat(5,12,8,0,"Dk. Gray ████████");
printat(5,13,9,0,"Br. Blue ████████");
printat(5,14,10,0,"Br. Green ████████");
printat(5,15,11,0,"Br. Cyan ████████");
printat(5,16,12,0,"Br. Red ████████");
printat(5,17,13,0,"Br. Magenta ████████");
printat(5,18,14,0,"Yellow ████████");
printat(5,19,15,0,"White ████████");
delay(1500);
for(int i=1;i<16;i++) {
fadeout(i);
fadein(i);
}
demo1window.fill();
printat(42,11,15,1," Press any key... ");
getch();
flushkeys();
demo1window.hide();
}
//**************************************************************************
void demo2()
{
Twindow demo2window;
demo2window.init(20,5,61,10,15,1,0,0);
demo2window.show();
printc(7,15,1,"Instantly set any color to black,");
printc(8,15,1,"then fade in when appropriate.");
Twindow greenwindow;
Twindow cyanwindow;
Twindow redwindow;
Twindow magentawindow;
Twindow brownwindow;
greenwindow.init(15,12,25,17,2,2,0,0);
blankcolor(2);
cyanwindow.init(25,12,35,17,3,3,0,0);
blankcolor(3);
redwindow.init(35,12,45,17,4,4,0,0);
blankcolor(4);
magentawindow.init(45,12,55,17,5,5,0,0);
blankcolor(5);
brownwindow.init(55,12,65,17,6,6,0,0);
blankcolor(6);
greenwindow.show();
cyanwindow.show();
redwindow.show();
magentawindow.show();
brownwindow.show();
delay(1500);
fadein(2);
delay(500);
fadein(3);
delay(500);
fadein(4);
delay(500);
fadein(5);
delay(500);
fadein(6);
delay(500);
demo2window.fill();
printc(8,15,1,"Press any key...");
getch();
flushkeys();
brownwindow.hide();
magentawindow.hide();
redwindow.hide();
cyanwindow.hide();
greenwindow.hide();
demo2window.hide();
}
//**************************************************************************
void demo3()
{
Twindow demo3window;
demo3window.init(10,5,71,7,15,2,0,0);
demo3window.show();
printc(6,15,2,"\"Slide\" from one color into the next for exciting effects!");
Twindow slidewindow;
slidewindow.init(20,12,61,22,1,1,0,0);
slidewindow.show();
delay(1000);
fade1_3();
delay(500);
fade3_1();
delay(500);
fade1_4();
delay(500);
fade4_1();
delay(500);
fade1_5();
delay(500);
fade5_1();
delay(500);
demo3window.fill();
printc(6,15,2,"Press any key...");
getch();
flushkeys();
slidewindow.hide();
demo3window.hide();
}
//**************************************************************************
void demo4()
{
Twindow demo4window;
int r,g,b,i;
demo4window.init(40,5,75,14,15,1,0,0);
demo4window.show();
printat(42,7,15,1," Bored with the standard 16");
printat(42,8,15,1," color palette?");
printat(42,10,15,1," CHANGE IT!");
printat(5,5,1,0,"Color 1 ████████");
printat(5,6,2,0,"Color 2 ████████");
printat(5,7,3,0,"Color 3 ████████");
printat(5,8,4,0,"Color 4 ████████");
printat(5,9,5,0,"Color 5 ████████");
printat(5,10,6,0,"Color 6 ████████");
printat(5,11,7,0,"Color 7 ████████");
printat(5,12,8,0,"Color 8 ████████");
printat(5,13,9,0,"Color 9 ████████");
printat(5,14,10,0,"Color 10 ████████");
printat(5,15,11,0,"Color 11 ████████");
printat(5,16,12,0,"Color 12 ████████");
printat(5,17,13,0,"Color 13 ████████");
printat(5,18,14,0,"Color 14 ████████");
printat(5,19,15,0,"Color 15 ████████");
delay(3000);
printat(42,12,15,1," Press any key to end...");
flushkeys();
while(!kbhit()) {
for(i=1;i<16;i++)
rgb(i,random(63),random(63),random(63));
delay(1000);
}
set_default_palette();
delay(2000);
demo4window.hide();
}
//**************************************************************************
void demo5()
{
Twindow demo5window;
demo5window.init(5,5,76,12,15,1,0,0);
demo5window.show();
printc(7,15,1,"As you know, if you try to use colors 8 through 15 as");
printc(8,15,1,"background colors, the foreground begins to blink against your will.");
delay(2000);
printc(10,14,1,"Well now you're in control!");
disable_blink();
delay(1000);
printc(15,0,15," Black on white ");
delay(1000);
printc(17,5,14," Magenta on yellow ");
delay(1000);
printc(19,15,9," Any combination! ");
delay(2000);
printc(22,15,0,"Press any key...");
flushkeys();
getch();
enable_blink();
demo5window.hide();
}
//**************************************************************************
void demo6()
{
Twindow demo6window;
demo6window.init(5,5,76,13,15,1,0,0);
demo6window.show();
printc(7,15,1,"Ever want to turn the screen off during a massive screen");
printc(8,15,1,"drawing routine so that the user doesn't have to (or doesn't");
printc(9,15,1,"get to) see it all happening?");
delay(3000);
printc(11,14,1,"Press any key to DO IT!");
flushkeys();
getch();
flushkeys();
disable_refresh();
demo6window.hide();
Twindow w1,w2,w3,w4,w5;
w1.init(15,5,25,10,15,1,1,7);
w1.show();
w2.init(25,7,35,12,15,2,1,7);
w2.show();
w3.init(35,9,45,14,15,3,1,7);
w3.show();
w4.init(45,11,55,16,15,4,1,7);
w4.show();
w5.init(55,13,65,18,15,5,1,7);
w5.show();
delay(1000);
enable_refresh();
delay(1500);
printc(22,15,0,"Press any key...");
flushkeys();
getch();
}
//**************************************************************************
void outro()
{
Twindow outrowindow;
outrowindow.init(4,6,77,18,14,2,0,0);
outrowindow.title("Summary");
outrowindow.show();
printc(8,14,2,"These are the highlights...the raw materials for your");
printc(9,14,2,"creative ideas. Note that while this demo was in text mode,");
printc(10,14,2,"these functions work equally as well in graphics mode.");
printc(11,14,2,"Please read the complete documentation file for specific");
printc(12,14,2,"information on using these functions in your programs.");
printc(14,14,2,"Thank you for previewing software from Ludicrous Data.");
printc(16,15,2,"Press any key now to return to DOS...");
flushkeys();
getch();
flushkeys();
outrowindow.hide();
}
//**************************************************************************
// SUMITUP
//**************************************************************************
void sumitup()
{
restorecrtmode();
dlay(18);
cursoroff();
Twindow mainwindow;
mainwindow.init(5,1,76,23,15,1,0,0);
mainwindow.show();
mainwindow.divider(HOR,DOUBLE,2);
mainwindow.wprintc(1,14,1,"That's not all...");
printc(5,15,1,"This demo can hardly describe all of the features and power");
printc(6,15,1,"at your beckoning by using the ObjectEase library. There are");
printc(7,15,1,"many more classes for which there just isn't time to");
printc(8,15,1,"demonstrate here. Some of these include: SoundQ which allows");
printc(9,15,1,"you to play music in the background while foreground processes");
printc(10,15,1,"continue to execute; Output routines which allow fast, snow-");
printc(11,15,1,"free output to the screen; Bitmaps which allow you to include");
printc(12,15,1,"and manipulate graphic images within your programs; Support");
printc(13,15,1,"for 256 color graphics modes and editors for creating button,");
printc(14,15,1,"icon, and bitmap images for these graphics modes. The list goes");
printc(15,15,1,"on! Ask yourself what it will cost if you don't acquire this");
printc(16,15,1,"extensive library. Ask what it would cost to piece it together");
printc(17,15,1,"from other vendor's libraries. Now tell yourself of the power");
printc(18,15,1,"and efficiency you will gain by acquiring this library now!");
printc(19,15,1,"What are you waiting for?!");
dlay(18*8);
printc(21,15+128,1,"Press any key...");
flushkeys();
getch();
flushkeys();
}